package com.blogspot.javagamexyz.gamexyz.ui;

import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.blogspot.javagamexyz.gamexyz.screens.control.overworld.InputManager;
import com.blogspot.javagamexyz.gamexyz.screens.control.overworld.MenuProcessor;

//The HUD which the user can interface with. I guess it's more of a UI really...
public class InterfaceHUD {

	Skin skin;
	Stage stage;
	HUD hud;
	
	//private MenuProcessor menuProcessor;
	private InputManager inputManager;
	private MenuProcessor menuProcessor;
	
	public Button button1;
	
	public InterfaceHUD(InputManager inputManager, MenuProcessor menuProcessor, Stage stage){
		this.inputManager = inputManager;
		this.menuProcessor = menuProcessor;
		this.stage = stage;		    	
		
		FileHandle skinFile = new FileHandle("resources/uiskin/uiskin.json");
		skin = new Skin(skinFile);				
		
		hud = new HUD(skin, 500, 100);	//TODO make this work with smaller screens and stuff	//1280(w)-250(statsHud) = 1050

		createButtons();		
		populateTable();				

		hud.addToStage(stage, 250, 100);
	}

	private void createButtons() {
		//create buttons and their respective listeners 
		//might not use this since buttons don't need to be tracked right now		
	}
	
	private void populateTable() {
		//Explore Button
		ChangeListener exploreListener = new ChangeListener() {
			@Override
			public void changed(ChangeEvent event, Actor actor) {
				menuProcessor.explore();	//TODO maybe having the inputmanager act here is causing the click to not register?
			}
		};
		hud.addButton("Explore", exploreListener, inputManager.canAct());
		
		//Something button
		
		//Character Button
		
		//Menu Button
		ChangeListener mainMenuListener = new ChangeListener() {
			@Override
			public void changed(ChangeEvent event, Actor actor) {
				menuProcessor.menu();
			}
		};
		hud.addButton("Main Menu", mainMenuListener, true);
		
	}



}
